package com.bdqn.mapper;

import com.bdqn.pojo.SysRole;
import com.bdqn.pojo.SysUser;
import org.mybatis.spring.SqlSessionTemplate;

import java.util.List;

public class SysUserMapperImpl implements SysUserMapper{
    private SqlSessionTemplate sqlSession;

    @Override
    public List<SysUser> selectSysUserList(SysUser sysUser) {
        return sqlSession.selectList("com.bdqn.mapper.SysUserMapper.selectSysUserList", sysUser);
    }

    @Override
    public boolean add(SysUser sysUser) {
       return sqlSession.getMapper(SysUserMapper.class).add(sysUser);

    }

    @Override
    public int del(int id) {
        return sqlSession.getMapper(SysUserMapper.class).del(id);
    }

    @Override
    public int upd(int id, String password) {
        return sqlSession.getMapper(SysUserMapper.class).upd(id, password);
    }

    @Override
    public int updateId(SysRole sysRole) {
        return sqlSession.getMapper(SysUserMapper.class).updateId(sysRole);
    }

    @Override
    public int deleteUser(Integer userId) {
        return sqlSession.getMapper(SysUserMapper.class).deleteUser(userId);
    }

    @Override
    public int delete(Integer id) {
        return sqlSession.getMapper(SysUserMapper.class).delete(id);
    }


    public void setSqlSession(SqlSessionTemplate sqlSession) {
        this.sqlSession = sqlSession;
    }
}
